<?php
    //接受传递过来的商品id 
	$id=$_GET['id'];
	     //引入配置文件
	 require '../public/config.php';
	 require '../public/mysql.php';
	 require '../public/function.php';
	   session_start();
	 @$name= $_SESSION['admin']['user'];
	 //连接数据库
	 $link= connect();
	 //准备SQL和执行SQL
	 $sql="select * from goods where id= {$id}";
    if($link['error']){
		  $result=query($link['mess'],$sql);
	}
    $goods= $result[0];
	$cid=$goods['cid'];
	//连接数据库查询出所有的分类
	$link= connect();
	//准备SQL和执行sql
	if($link['error']){
	    $sql="select * from category";
	    $cates =query($link['mess'],$sql);
	}
   $breadcrumb =  getFather($cates, $cid);


   	if(isset($_GET['zhi'])){
		
		$gid=$_GET['id'];
		$zhi=$_GET['zhi'];
		$_SESSION['cart'][$gid]['num']=$_SESSION['cart'][$gid]['num'] + $zhi;
		if($_SESSION['cart'][$gid]['num']<1){
			$_SESSION['cart'][$gid]['num']=1;
		}
	}
  
?>



<html>
    <head>
	    <title>商品列表</title>
		<meta charset="utf-8">
		<link type="text/css" rel="stylesheet" href="style/reset.css">
		<link type="text/css" rel="stylesheet" href="style/spxq.css">
		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
	    <script type="text/javascript" src="js/cart1.js"></script>
	</head>

    <body>
	    <div class="headerBar">
		
		<div class="topBar">
		        <div class="comWidth">
				    <?php if (empty($_SESSION['admin']['user']) ) :?>
					<a href="./web/login.php">登录</a>
					<a href="./web/adduser.php">注册</a>
					<?php else :?>
					<p>欢迎回来，<?php echo $_SESSION['admin']['user'];?>
					<a href="./web/action.php?a=logout">退出</a></p>
					<?php endif;?>
				</div>
		</div>

         <div class="logoBar">
		      <div class="comWidth">
			      <div class="logo fl">
				    <a href="#"><img src="./images/logo.jpg" alt="汤浅蓄电池"></a>
				  </div>
				  <div class="search_box fl">
				      <input type="text" class="search_text fl">
					  <input type="button" value="搜 索" class="search_btn fr">
				  </div>
				  <div class="shopCar fr">
				      <span class="shopText fl">购物车</span>
					  <span class="shopNum fl">0</span>
				  </div>
			  </div>
		 </div>
<!--  导航-->
        <div class="nav">
		<div class="comWidth">
		   <div class="nav_left">
		     <h3>全部商品分类</h3>  
		   </div>
		    <ul class="nav_right">
			   <li class="nav_active1">电瓶上门</li>
			   <li class="nav_active">轮胎</li>
			   <li class="nav_active">保养</li>
			   <li class="nav_active">车品</li>
			   <li class="nav_active">轮毂</li>
			   <li class="nav_active">服务门店</li>
		    </ul>
		
		
		</div>
		</div>  

<!-- 内容 -->       
     <div class="mainContent comWidth">
		<div class="userPosition">
			<a href="#" class="b">首页></a>
		    <?php foreach ($breadcrumb as $val) :?>
			<a><?php echo $val['name']?></a>
			<?php endforeach;?>
			><a ><?php echo  $goods['name']?></a>
		</div> <!-- userPosition end -->
		<div class="detail-info white_bg">
			<div class="detail-left fl">
				<div class="detail-bigImg">
					<a href="#"><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="商品大图"></a>
				</div> <!-- 大图部分 结束 -->
				<div class="detail-preview">
					<a href="#"><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="预览小图"></a>
					<a href="#" class="active"><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="预览小图"></a>
					<a href="#" ><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="预览小图"></a>
					<a href="#"><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="预览小图"></a>
					<a href="#"><img src="<?php echo '../public/upload/'.$goods['pic']?>" alt="预览小图"></a>
				</div> <!-- 预览图部分 -->
			</div>
			<div class="detail-right fr">
				<div class="right-box">
					<div class="right-top">
						<h3><?php echo $goods['dsecr']?></h3>	
						<dl>
							<dt>汤浅价</dt>
							<dd class="price"><span><i>¥</i><?php echo $goods['price']?></span></dd>
						</dl>
						<dl class="hg">
							<dt>优惠</dt>
							<dd><i>满换购</i>购蓄电池加价优惠润滑油</dd>
						</dl>
					</div> <!-- right-top end -->
					<div class="right-middle cl">
						<dl>
							<dt>送到</dt>
							<dd><select name="add" id="select-add" >
								<option value="1">苏州新东方汽配城</option>
							</select></dd>
							<dd class="dd-des">有货,可当天出库</dd>
						</dl>
						<form action="action.php?a=addCart" method="post" class="choose">
						<dl class="right-select">
							<dt>选择颜色</dt>
							<dd><a class="right-select-active" href="#">白色</a><a href="#">黑色</a><a href="#">灰色</a></dd>
						</dl>
						<dl class="right-select-standerd">
							<dt>选择规格</dt>
							<dd><a class="right-select-active" href="#">【丰田】新花冠卡罗拉逸致新威弛</a><a href="#">【丰田】普拉多巡洋舰进口</a><a href="#">【丰田】皇冠（新）/锐志</a><a href="#">【丰田】RAV4/佳美/凯美瑞汉兰达</a><a href="#">【丰田】RAV4/佳美/凯美瑞汉兰达</a><a href="#">【丰田】考斯特(柴)/考斯特(汽)</a></dd>
						</dl>
						<dl class="right-select-amount">
							<dt>数量</dt>
							<dd>
								<!-- 计数组件 -->
								<a href="javascript:;" id="reduce_num"></a>
										<input type="hidden" name="gid" value="<?php echo $goods['id']?>">
										<input type="text" name="amount" value="1" class="amount"/>
										<a href="javascript:;" id="add_num"></a>
								</div> <!-- 计数组件 结束 -->
							</dd>
							<div class="dd-des fl">限购<span>9</span>件</div>
						</dl>
					</div> <!-- right-middle end -->
					<div class="right-bottom">
						<div class="right-bottom-selected">已选择<span>“白色|免维护</span></div>
						<div class="buyButton-box">
							<div class="button-box-add"><input type="submit" value="加入购物车"></div>
							<div class="button-box-buy"><input type="button" value="立即购买"></div>
						</div>
						<div class="right-bottom-tips cl">注意：此商品可提供普通发票，不提供增值税发票。</div>
					</div>
                    </form>
				</div> <!-- right-box end -->
			</div> <!-- detail-right end-->

		</div><!-- detail end -->
		<div class="bottom-box comWidth">
			<div class="leftArea fl">
				<div class="left-item">
					<div class="left-title">
						<h3>同价位</h3>
					</div>
					<!-- 产品信息 -->
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
				</div> <!-- left-item end -->
				<div class="left-item ">
					<div class="left-title onePixTop">
						<h3>看了最终买</h3>
					</div>
					<!-- 产品信息 -->
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
					<div class="product-item">
						<div class="picBox">
							<a href="#"><img src="images/轮胎.jpg" alt="轮胎"></a>
						</div>
						<p>固特异轮胎 三能 EXCELLENCE 235/60R18 103W Goodyear[奥迪Q5原配]</p>
						<span>￥1999.00</span>
					</div>
				</div> <!-- left-item end -->
			</div>
			<div class="rightArea fr">
				<div class="rated">
					<div class="top-tab">
						<ul>
							<li><a href="#">产品介绍</a></li>
							<li><a href="#" class="active">商品评价(1234)</a></li>
						</ul>
					</div>  <!-- tab end -->
					<div class="rated-star">
						<h4>商品评价</h4>
						<div class="rated-progress">
							<div class="rated-point fl">
								<span>4.7</span>分
							</div>
							<div class="rated-progress-bar fl">
								<div class="point">4.7<i></i></div>
								<div class="bar">
									<ul>
										<li>非常不满</li>
										<li>不满意</li>
										<li>满意</li>
										<li>一般</li>
										<li>满意</li>
										<li>非常不满</li>
									</ul>
								</div>
								<div class="hr-10"></div>
								<p>共18939位汤浅网友参与评分</p>
							</div>
						</div>
					</div>
					<div class="middle-tab">
						<ul>
							<li ><a class="active" href="#">全部</a></li>
							<li><a href="#">满意(12546)</a></li>
							<li><a href="#">一般(233)</a></li>
							<li><a href="#">不满意(23)</a></li>
						</ul>
						<div class="sort fr">
							<a href="#" class="sort-time">时间排序</a>
							<a href="#" class="sort-recommend">推荐排序<div class="new"></div></a>
							
						</div>

					</div>
					<div class="rated-item cl">
						<div class="user-info fl">
							<!-- 用户信息 -->
							<div class="user-pic">
								<img src="images/user-pic.jpg" alt="用户头像">
							</div>
							<div class="user-name">
								2729**081
							</div>
							<div class="user-level">
								金牌用户
							</div>
						</div>
						<div class="user-rated fl">
							<!-- 评价内容 -->
							<div class="user-rated-star fl">
								<span></span><h5>5分,非常满意</h5>
								<p class="time">2016-07-22 13:30:25</p>
							</div>
							<p class="cl">挺不错的，信赖汤浅</p>
							<a href="#">顶(0)</a><a href="#">踩(0)</a>
						</div>
					</div> <!-- rated-item end -->
					<div class="rated-item cl">
						<div class="user-info fl">
							<!-- 用户信息 -->
							<div class="user-pic">
								<img src="images/user-pic2.jpg" alt="用户头像">
							</div>
							<div class="user-name">
								4908**179
							</div>
							<div class="user-level">
								铜牌用户
							</div>
						</div>
						<div class="user-rated fl">
							<!-- 评价内容 -->
							<div class="user-rated-star fl">
								<span></span><h5>5分,非常满意</h5>
								<p class="time">2016-07-22 13:30:25</p>
							</div>
							<p class="cl">挺不错的，信赖汤浅</p>
							<a href="#">顶(0)</a><a href="#">踩(0)</a>
						</div>
					</div> <!-- rated-item end -->
					<div class="pagesBox cl">
						<ul>
							<li><a href="#" class="unClick">上一页</a></li>
							<li><a href="#" class="pagesBox-active">1</a></li>
							<li><a href="#">2</a></li>
							<li><a href="#">3</a></li>
							<li><a href="#">4</a></li>
							<li><a href="#">···</a></li>
							<li><a href="#">200</a></li>
							<li><a href="#">下一页</a></li>
							<div class="pagesBox-jump fr">共200页，到第<input value="2" type="text">页 <button>确定</button></div>
						</ul>
					</div>
				</div> <!-- 评价部分结束 -->
				<div class="ask">
					<div class="ask-tab">
						<a href="#" class="all fl">全部咨询(123)</a>
						<div class="publish-box fl">
							<a href="#" class="publish fr">发表咨询</a>
						</div>
					</div> <!-- ask-tab end -->
					<div class="ask-warning-box">
						<p class="ask-warning">提示:因厂家更改产品包装、产地或者更换随机附件等没有任何提前通知，且每位咨询者购买情况、提问时间等不同，为此以下回复信息仅供参考！若由此给您带来不便请多多谅解，谢谢！</p>
					</div>
					<div class="ask-item">
						<div class="user-info fl">
							<!-- 用户信息 -->
							<div class="user-pic">
								<img src="images/user-pic.jpg" alt="用户头像">
							</div>
							<div class="user-name">
								2729**081
							</div>
							<div class="user-level">
								金牌用户
							</div>
						</div> <!--  用户信息 -->
						<div class="user-ask-content fl">
							<h5>[商品咨询]<p class="time">2016-07-22 13:30:25</p></h5>
							<p>还能再便宜点么?</p>
							<div class="arrow"></div>
							<div class="reply">
								<span>沈晓娟回复:</span>您好，现在已经是活动价格了
							</div>
						</div>
					</div><!--  ask-item end -->
					<div class="ask-item">
						<div class="user-info fl">
							<!-- 用户信息 -->
							<div class="user-pic">
								<img src="images/user-pic.jpg" alt="用户头像">
							</div>
							<div class="user-name">
								4585**081
							</div>
							<div class="user-level">
								金牌用户
							</div>
						</div> <!--  用户信息 -->
						<div class="user-ask-content fl">
							<h5>[商品咨询]<p class="time">2016-07-22 13:30:25</p></h5>
							<p>我是共产主义接班人,能便宜不?</p>
							<div class="arrow"></div>
							<div class="reply">
								<span>徐国峰回复:</span>滚
							</div>
						</div>
					</div><!--  ask-item end -->
					<div class="pagesBox cl">
						<ul>
							<li><a href="#" class="unClick">上一页</a></li>
							<li><a href="#" class="pagesBox-active">1</a></li>
							<li><a href="#">2</a></li>
							<li><a href="#">3</a></li>
							<li><a href="#">4</a></li>
							<li><a href="#">下一页</a></li>
							<div class="pagesBox-jump fl">到第<input value="2" type="text">页 <button>确定</button></div>
						</ul>
					</div>
				</div><!-- 咨询部分结束 -->
			</div>
		</div> <!-- bottom-box end -->
	</div><!-- mainContent end -->
<!-- 商品详情结束 -->
<!--底部   -->
                         <div class="hr"></div>
						 <div class="footer">
                            <p><a href="#">汤浅简介</a><i>|</i><a href="#">招兵买马</a><i>|</i><a href="#">汤浅新闻</a><i>|</i><a href="#">广告与市场合作</a><i>|</i><a href="#">联系我们</a></p>
                            <p>© 2004-2016 beixing.cn Corporation, All Rights Reserved 北星苏州有限公司 版权所有 苏ICP备11004912号</p>
                            <p class="web"><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a><a href="#"><img src="images/chengxin.png" alt="logo"><a></p>
						</div>




























	</body>
</html>